|
|
 |
|
|
|
|
mstrDefault = strDefault
' Get Value mstrKeyValue = Space(MAX_VALUE)
lngRet = GetPrivateProfileString( _
mstrSection, _
mstrKeyName, _
mstrDefault, _
mstrKeyValue, _
MAX_VALUE, _
mstrConfigName) If lngRet > 0 Then
mstrKeyValue = Left$(mstrKeyValue, lngRet)
Else
mstrKeyValue = ""
End If
KeyGet = mstrKeyValue
End Function |
|
|
|
|
|
|
|
|
Using the INI Class to Save Data |
|
|
|
|
|
|
|
|
If you fill in the Key Value text box with a different value and then click the Save W/Class command button in the sample form, youll see that information can be saved back to the INI file. The Click event for this command button instantiates an instance of the INI class. Set the values from the text boxes and then invoke the KeySave() method to retrieve the data. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub cmdSaveClass_Click()
Dim oIni As INI
Set oIni = New INI
With oIni
.ConfigName = Trim$(txtConfig)
.Section = Trim$(txtSection)
.KeyName = Trim$(txtKeyName)
.KeyValue = Trim$(txtKeyValue)
.KeySave
End With |
|
|
|
|
|